package com.syc.ext;

import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.StringUtils;

public class GenCodeService {

	/**
	 * 表名转换成Java类名
	 */
	public String tableToJava(String tableName, String tablePrefix) {
		if (StringUtils.isNotBlank(tablePrefix)) {
			tableName = tableName.replaceFirst(tablePrefix, "");
		}
		return columnToJava(tableName);
	}

	/**
	 * 列名转换成Java属性名
	 */
	public String columnToJava(String columnName) {
		return WordUtils.capitalizeFully(columnName, new char[] { '_' }).replace("_", "");
	}

}
